From: kaf24@firebug.cl.cam.ac.uk Date: Tue, 13 Sep 2005 19:09:44 +0000 (+0000) Subject: Fix the logic in vcpu_sleep_sync(): we must wait until X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16806^2~30 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=5bcdcd40ecf4780fe12c2cd554ac1f3bdf68b71b;p=xen.git Fix the logic in vcpu_sleep_sync(): we must wait until the running flag is cleared *and* the scheduler lock is released. Not just one or the other. Signed-off-by: Ryan Harper --- diff --git a/xen/common/schedule.c b/xen/common/schedule.c index ff9373d60f..77e0055e8c 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -211,11 +211,12 @@ void vcpu_sleep_sync(struct vcpu *v) /* * We can be sure that the VCPU is finally descheduled after the running - * flag is cleared and the scheduler lock is released. + * flag is cleared and the scheduler lock is released. We also check that + * the domain continues to be unrunnable, in case someone else wakes it. */ - while ( test_bit(_VCPUF_running, &v->vcpu_flags) - && !domain_runnable(v) - && spin_is_locked(&schedule_data[v->processor].schedule_lock) ) + while ( !domain_runnable(v) && + (test_bit(_VCPUF_running, &v->vcpu_flags) || + spin_is_locked(&schedule_data[v->processor].schedule_lock)) ) cpu_relax(); sync_vcpu_execstate(v);